<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../lib/vue-2.6.12.js"></script>
</head>
<body>

   <div id="app">
       <input type="text" @keyup.enter="sever" v-model="msg">
   </div>
   <script>
       const vm = new Vue({
           data:{
               msg:'',
               list:[
                   'ab','bb','cb'
               ]
           },
           methods:{
               sever(){
                  let dan = this.list.filter((e) => {
                      // console.log(e)
                     return  e.indexOf(this.msg) !== -1

                  })
                   console.log(dan)
               }

           }
       }).$mount('#app')
   </script>

   <script>

       // 判断一个字符串是否在某个字符串中
       let str = "mess"
       let index = str.indexOf("ss")
       console.log(index)   // 2

       // 字符串转化为数组 split
       let A = 'abc'
       let B = A.split("")
       console.log(A)     // abc
       console.log(B)     // 对象里有 a,b,c
       console.log(B.length)

       // 数组转化为字符串 join
       let a = ['1','2','3']
       let b = a.join("*")
       console.log(a) // 对象里面有1,2,3
       console.log(b) // 1*2*3

       // 修改字符串 replace
       let str2 = str.replace("ss","ssage")
       console.log(str2) // message

       // 分割字符串 split
       let str3 = str.split('')
       console.log(str3) // ['m','e','s','s']

       // 字母大小写
       let str4  = 'abcd'
       let str5 = str4.toUpperCase()
       console.log(str5) // ABCD
       let str6 = str5.toLowerCase()
       console.log(str6) // abcd


   </script>
</body>
</html>